﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HA.ModFlow.Controls.MT3DMSWindows
{
    /// <summary>
    /// winMTOutputControlInitializeTimes.xaml 的交互逻辑
    /// </summary>
    public partial class winMTOutputControlInitializeTimes : Window
    {
        public winMTOutputControlInitializeTimes()
        {
            InitializeComponent();

            this._pcInitTimes = new PCMTInitTimes();

            this.DataContext = this._pcInitTimes;
        }

        PCMTInitTimes _pcInitTimes;

        public PCMTInitTimes PcInitTimes
        {
            get { return _pcInitTimes; }
            set { _pcInitTimes = value; }
        }

        private double[] _timeSteps;

        public double[] TimeSteps
        {
            get { return _timeSteps; }
            set { _timeSteps = value; }
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {

            Getarry(this.PcInitTimes.InitStepSize,this .PcInitTimes .Bias, this.PcInitTimes.MaxStepSize, this.PcInitTimes.MaxTime);
         

            this.DialogResult = true;
            this.Close();
        }
        private List<double> _arry = new List<double>();

        public List<double> Arry
        {
            get { return _arry; }
            set { _arry = value; }
        }
        private void Getarry(double ini, double bias, double step, double max)
        {
            Arry.Clear();
            double num = 0;
            Arry.Add(ini);
            int i = 0;
            while (num <= max)
            {
                num = Arry[i] * bias;
                if (num <= step)
                {
                    num = num + ini;
                }
                else
                {
                    num = Arry[i] + step;
                }
                if (num >= max)
                {
                    Arry.Add(max);
                    break;
                }
                Arry.Add(num);
                i++;
            }

            }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
